<?php
    
  $aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
  $EmployeeUid = str_replace ( '"', '', $aux[0] );
  
  // rme added
  if (empty($EmployeeUid)) $EmployeeUid =  $_SESSION["EMPLOYEE"];
  $_SESSION["EMPLOYEE"] = $EmployeeUid;

  include( PATH_PLUGINS . 'hr' . PATH_SEP . 'submenuhrEmployee.inc.php' );
  // rme end

  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrEmployee.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrEmployeePeer::retrieveByPK( $EmployeeUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrEmployee' ) ) { 
     $fields['EMPLOYEE_UID'] = $tr->getEmployeeUid();
     $fields['EMPLOYEEFIRSTNAME'] = $tr->getEmployeefirstname();
     $fields['EMPLOYEEMIDDLENAME'] = $tr->getEmployeemiddlename();
     $fields['EMPLOYEELASTNAME'] = $tr->getEmployeelastname();
     $fields['EMPLOYEECALLEDNAME'] = $tr->getEmployeecalledname();

     $fields['EMPLOYEEPREFIX_ID'] = $tr->getEmployeeprefixId();
     $fields['EMPLOYEESUFFIX_ID'] = $tr->getEmployeesuffixId();

     $fields['EMPLOYEEWORKEMAIL'] = $tr->getEmployeeworkemail();
     $fields['EMPLOYEEPERSONALEMAIL'] = $tr->getEmployeepersonalemail();
     $fields['EMPLOYEEHOMEPHONE'] = $tr->getEmployeehomephone();
     $fields['EMPLOYEEMOBILEPHONE'] = $tr->getEmployeemobilephone();
     $fields['EMPLOYEEWEBPAGE'] = $tr->getEmployeewebpage();
     $fields['EMPLOYEEGENDER_ID'] = $tr->getEmployeegenderId();
     $fields['EMPLOYEEDATEOFBIRTH'] = $tr->getEmployeedateofbirth();
     $fields['EMPLOYEESTATE_ID'] = $tr->getEmployeestateId();
     $fields['EMPLOYEESSN'] = $tr->getEmployeessn();
     $fields['EMPLOYEEPICTURE'] = $tr->getEmployeepicture();
     $fields['EMPLOYEEISHISPANIC'] = $tr->getEmployeeishispanic();
     $fields['EMPLOYEEISASIAN'] = $tr->getEmployeeisasian();
     $fields['EMPLOYEEISAFRICANAMERICAN'] = $tr->getEmployeeisafricanamerican();
     $fields['EMPLOYEEISAMERICANINDIAN'] = $tr->getEmployeeisamericanindian();
     $fields['EMPLOYEEISALASKANATIVE'] = $tr->getEmployeeisalaskanative();
     $fields['EMPLOYEEISHAWAIIANOROTHERPACIFICISLANDER'] = $tr->getEmployeeishawaiianorotherpacificislander();
     $fields['EMPLOYEEISWHITE'] = $tr->getEmployeeiswhite();
     $fields['DISTRICT_ID'] = $tr->getDistrictId();
     $fields['DISTRICTPHONE'] = $tr->getDistrictphone();
     $fields['DISTRICTEXTENSION'] = $tr->getDistrictextension();
     $fields['HOMEPHONEUNLISTED'] = $tr->getHomephoneunlisted();
     $fields['MARITALSTATUS_ID'] = $tr->getMaritalstatusId();
     $fields['SUBDAYS'] = $tr->getSubdays();
     $fields['OSDIDISTRICTCODE'] = $tr->getOsdidistrictcode();
     $fields['DIRECTDEPOST'] = $tr->getDirectdepost();
     $fields['RETIREMENTELIGIBLE'] = $tr->getRetirementeligible();
     $fields['HANDICAPSTATUS'] = $tr->getHandicapstatus();
     $fields['MULTILINGUAL'] = $tr->getMultilingual();
     $fields['REPORTTOEMIS'] = $tr->getReporttoemis();
     $fields['ODHSREPORTED'] = $tr->getOdhsreported();
//     $fields['EMPLOYEETYPE_ID'] = $tr->getEmployeetypeId();
     $fields['EMISEMPLOYEEID'] = $tr->getEmisemployeeid();
     $fields['EMAILDIRECTDEPOST'] = $tr->getEmaildirectdepost();

     $fields['BOARDHIREDATE'] =                $tr->getBoardhiredate();
     $fields['FBIBGCHECKDATE'] =               $tr->getFbibgcheckdate();
     $fields['BCIBGCHECKDATE'] =               $tr->getBcibgcheckdate();
     $fields['TBTESTDATE'] =                   $tr->getTbtestdate();
     $fields['OVRBGCHECKDATE'] =               $tr->getOvrbgcheckdate();
     $fields['CPIDATE'] =                      $tr->getCpidate();
     $fields['HQTEACHER'] =                    $tr->getHqteacher();
     $fields['OUTOFSTATEEXPERIENCE'] =         $tr->getOutofstateexperience();
     $fields['INOFSTATEPUBEXPERIENCE'] =       $tr->getInofstatepubexperience();
     $fields['INOFSTATENONPUBEXPERIENCE'] =    $tr->getInofstatenonpubexperience();
     $fields['INDISTRICTEXPERIENCE'] =         $tr->getIndistrictexperience();
     $fields['MILITARYTIME'] =                 $tr->getMilitarytime();
     $fields['PURCHASEDSERVICECREDIT'] =       $tr->getPurchasedservicecredit();
    }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrEmployee';
  $G_ID_MENU_SELECTED = 'ID_HR_EMP';
  $G_ID_SUB_MENU_SELECTED = '';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrEmployeeEdit', '', $fields, 'hrEmployeeSave' );
  G::RenderPage('publish', 'blank');   
?>